import java.util.Arrays;

/**
 * @Author 12629
 * @Description：
 */
public class Test {
    public static void transform1(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
    }
    public static int[] transform(int[] array) {
        int[] tmp = new int[array.length];

        for (int i = 0; i < array.length; i++) {
            tmp[i] = array[i] * 2;
        }
        return tmp;
    }

    public static void change(int[] array) {
        int i = 0;
        int j = array.length-1;
        while (i < j) {
            //1 3 5
            //    j i
            while (i < j && array[i] % 2 != 0) {
                i++;
            }
            while (i < j && array[j] % 2 == 0) {
                j--;
            }
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
        }
    }

    public static int[] sum(int[] array,int target) {
        int[] ret = new int[]{-1,-1};
        for (int i = 0; i < array.length; i++) {
            for (int j = i+1; j < array.length; j++) {
                if(array[i] + array[j] == target) {
                    ret[0] = i;
                    ret[1] = j;
                }
            }
        }
        return ret;
    }

    public static int func1(int[] array) {
        int sum = 0;
        for (int i = 0; i < array.length; i++) {
            sum ^= array[i];
        }
        return sum;
    }

    public static int func2(int[] array) {
        Arrays.sort(array);
        return array[array.length/2];
    }

    public static boolean func3(int[] array) {
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 != 0) {
                count++;
                //每一次加完之后  count都有可能为3
                if(count == 3) {
                    return true;
                }
            }else {
                count = 0;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        int[] array = {2,2,1,16,1,2,2};
        System.out.println(func3(array));

       /* int[] ret = sum(array,28);
        System.out.println(Arrays.toString(ret));*/

       /* int[] ret = transform(array);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(ret));*/
    }
}
